package com.xgggh.redpack.ui.home.viewbinder;

import android.text.Html;

import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;

import com.xgggh.redpack.R;
import com.xgggh.redpack.base.viewbinder.BaseItemViewBinder;
import com.xgggh.redpack.base.viewbinder.BinderViewHolder;
import com.xgggh.redpack.databinding.ContentActivityItemBinding;
import com.xgggh.redpack.databinding.ContentRankItemBinding;
import com.xgggh.redpack.domain.activity.ActivityItem;
import com.xgggh.redpack.domain.rank.Rank;

public class RankViewBinder extends BaseItemViewBinder<Rank>  {

    @NonNull
    @Override
    public int getResId() {
        return R.layout.content_rank_item;
    }


    protected void onBindViewHolder(@NonNull BinderViewHolder holder, @NonNull Rank item) {
        super.onBindViewHolder(holder, item);
        ContentRankItemBinding binding= DataBindingUtil.getBinding(holder.itemView);
        binding.setItem(item);
        if (item.getRank()==1){
            binding.crown.setImageResource(R.drawable.ic_gold);
        }else if (item.getRank()==2){
            binding.crown.setImageResource(R.drawable.ic_silvery);
        }else if (item.getRank()==3){
            binding.crown.setImageResource(R.drawable.ic_copper);
        }else{
            binding.crown.setImageResource(R.drawable.ic_copper);
        }

    }
}
